001    /**
002     * Created by IntelliJ IDEA.
003     * User: Wei Wang
004     * Date: Nov 29, 2002
005     * Time: 12:57:16 AM
006     */
007    
008    package EVolve.util.painters;
009    
010    import EVolve.visualization.AutoImage;
011    import java.awt.*;
012    
013    public class CorrelationPainter extends Painter{
014        private int [][] value;
015    
016        public CorrelationPainter(int[][] value) {
017            this.value = value;
018        }
019    
020        public String getName() {
021            return "Correlation Painter";
022        }
023    
024        public void paint(AutoImage image, long x, long y, long z) {
025            for (int i = 0; i < value.length; i++) {
026                for (int j = 0; j < value[i].length; j++) {
027                    if (value[i][j] != 0) {
028                        //Color color = new Color((int)(value[i][j] * 255 / z), 0, (int)(255 - value[i][j] * 255 / z));
029                        image.setColor(i, j, Color.black);
030                    }
031                }
032            }
033        }
034    
035        public Object clone() {
036            CorrelationPainter o = (CorrelationPainter)super.clone();
037            o.value = new int[value.length][];
038            for (int i=0; i<value.length; i++) {
039                o.value[i] = new int[value[i].length];
040                for (int j=0; j<value[i].length; j++)
041                    o.value[i][j] = value[i][j];
042            }
043            return o;
044        }
045    }